package com.xinke.component.common.enums;

import cn.hutool.core.util.ObjUtil;
import com.xinke.component.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.checkerframework.checker.units.qual.A;

import java.util.Arrays;

/**
 * Description:通用状态枚举
 *
 * @Author yzx
 * @Create 2025/3/12 23:00
 * @Version 1.0
 */
@Getter
@AllArgsConstructor
public enum CommonStatusEnum implements ArrayValuable<Integer> {
    ENABLE(1, "开启"),
    DISABLE(0, "禁用");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(CommonStatusEnum::getStatus).toArray(Integer[]::new);
    /**
     * 状态值
     */
    private final Integer status;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }
    // 是否启用
    public static boolean isEnable(Integer status) {
        return ObjUtil.equal(ENABLE.status, status);
    }
    // 是否禁用
    public static boolean isDisable(Integer status) {
        return ObjUtil.equal(DISABLE.status, status);
    }

}
